package com.xuelang.pipeline.client.project;

import com.xuelang.pipeline.client.common.request.PageParam;
import com.xuelang.pipeline.client.common.result.ApiResult;
import com.xuelang.pipeline.client.common.result.PageRecord;
import com.xuelang.pipeline.client.project.dto.ProjectDTO;
import com.xuelang.pipeline.client.project.dto.ProjectQuery;
import com.xuelang.pipeline.client.project.dto.ProjectTypeDTO;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;
import java.util.List;

/**
 * <p>项目管理API接口</p>
 *
 * @author : yixin.lys
 * @date : 2024-09-02 17:43
 **/
public interface IProjectService {

    /**
     * 分页查询项目
     *
     * @param pageParam 分页查询参数
     * @return 返回分页结果
     */
    @PostMapping(value = "/page", produces = "application/json;charset=utf-8")
    ApiResult<PageRecord<ProjectDTO>> pageProject(@RequestBody @Valid PageParam<ProjectQuery> pageParam);

    /**
     * 新增项目
     *
     * @param projectDTO 项目数据
     * @return 返回新增的项目ID
     */
    @PostMapping(value = "/create", produces = "application/json;charset=utf-8")
    ApiResult<Integer> createProject(@RequestBody @Valid ProjectDTO projectDTO);

    /**
     * 根据ID删除项目
     *
     * @param id 项目ID
     * @return 返回是否删除成功
     */
    @DeleteMapping(value = "/delete/{id}", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> deleteProjectById(@PathVariable("id") Integer id);

    /**
     * 更新项目
     *
     * @param projectDTO 项目数据
     * @return 返回是否更新成功
     */
    @PutMapping(value = "/update", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> updateProject(@RequestBody @Valid ProjectDTO projectDTO);

    /**
     * 根据ID查询项目
     *
     * @param id 项目ID
     * @return 返回对应的项目数据
     */
    @GetMapping(value = "/find/{id}", produces = "application/json;charset=utf-8")
    ApiResult<ProjectDTO> findProjectById(@PathVariable("id") Integer id);

    /**
     * 查询所有项目
     *
     * @return 返回项目列表
     */
    @GetMapping(value = "/find-all", produces = "application/json;charset=utf-8")
    ApiResult<List<ProjectDTO>> findAllProjects();

    /**
     * 新增项目类型
     *
     * @param projectTypeDTO 项目类型数据
     * @return 返回新增的项目类型ID
     */
    @PostMapping(value = "/project-type/create", produces = "application/json;charset=utf-8")
    ApiResult<Integer> createProjectType(@RequestBody @Valid ProjectTypeDTO projectTypeDTO);

    /**
     * 根据ID删除项目类型
     *
     * @param id 项目类型ID
     * @return 返回是否删除成功
     */
    @DeleteMapping(value = "/project-type/delete/{id}", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> deleteProjectTypeById(@PathVariable("id") Integer id);

    /**
     * 更新项目类型
     *
     * @param projectTypeDTO 项目类型数据
     * @return 返回是否更新成功
     */
    @PutMapping(value = "/project-type/update", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> updateProjectType(@RequestBody @Valid ProjectTypeDTO projectTypeDTO);

    /**
     * 根据ID查询项目类型
     *
     * @param id 项目类型ID
     * @return 返回对应的项目类型数据
     */
    @GetMapping(value = "/project-type/find/{id}", produces = "application/json;charset=utf-8")
    ApiResult<ProjectTypeDTO> findProjectTypeById(@PathVariable("id") Integer id);

    /**
     * 查询所有项目类型
     *
     * @return 返回项目类型列表
     */
    @GetMapping(value = "/project-type/find-all", produces = "application/json;charset=utf-8")
    ApiResult<List<ProjectTypeDTO>> findAllProjectTypes();

    /**
     * 批量更新项目类型
     */
    @PostMapping(value = "/batchUpdate", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> batchUpdateProjectTypes(@RequestBody @Valid List<ProjectTypeDTO> projectTypeList);

}
